package top.someapp.dxf2dsvg.jfx;

import javafx.fxml.FXML;
import javafx.scene.control.Hyperlink;

import javax.annotation.Nonnull;
import java.awt.*;
import java.io.IOException;
import java.net.URI;

/**
 * @author zwz
 * Created on 2020-04-27
 */
public class About implements JfxController {
    @FXML
    Hyperlink linkAsposeCad;
    @FXML
    Hyperlink linkDom4j;
    @FXML
    Hyperlink linkBatik;

    @Override
    public void onCreate(@Nonnull JfxContext jfxContext) {
        linkAsposeCad.setOnAction(event -> browse("https://docs.aspose.com/display/cadjava/Home"));
        linkDom4j.setOnAction(event -> browse("http://www.dom4j.org/"));
        linkBatik.setOnAction(event -> browse("https://xmlgraphics.apache.org/batik/"));
    }

    private static void browse(String url) {
        try {
            Desktop.getDesktop().browse(URI.create(url));
        } catch (IOException e) {
//            e.printStackTrace();
        }
    }
}
